-
Notifications
You must be signed in to change notification settings - Fork 61
fix: update color property accessors to match Flutter's stable API #281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| final r = color.r; | ||
| final g = color.g; | ||
| final b = color.b; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to confirm
Line 11 in fcd46ba
| flutter: '>=3.22.0' |
color.r | g | b exist alreaduy in flutter 3.22 right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! I tested it with version 3.22.0 (FVM) and works fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecation message says https://api.flutter.dev/flutter/dart-ui/Color/green.html
Use (*.g * 255.0).round().clamp(0, 255)
Which to me seems that Color.g is in a different range (0-1) than Color.green (0 - 255)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah at least the deprecated message says to do the calculation/round and clamp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could update this to be the exact color that had before but with new API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah has to be the same color otherwise this function will not function properly
marandaneto
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @deandreamatias
💡 Motivation and Context
To avoid a info lint about deprecation.
Related PR on Flutter.
This would improve the pub points on pub.dev
💚 How did you test it?
When applied the change, the lint was solved
📝 Checklist